home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C & C++ Multimedia Cyber Classroom
/
C and C++ Multimedia Cyber Classroom (Prentice Hall) (1998).iso
/
cpphtp2
/
code.jar
/
code
/
ch11
/
fig11_21.txt
< prev
next >
Wrap
Text File
|
1998-02-27
|
736b
|
21 lines
1 // fIG. 11.21: fig11_21.cpp
2 // Controlling the printing of trailing zeros and decimal
3 // points for floating-point values.
4 #include <iostream.h>
5 #include <iomanip.h>
6 #include <math.h>
7
8 int main()
9 {
10 cout << "Before setting the ios::showpoint flag\n"
11 << "9.9900 prints as: " << 9.9900
12 << "\n9.9000 prints as: " << 9.9000
13 << "\n9.0000 prints as: " << 9.0000
14 << "\n\nAfter setting the ios::showpoint flag\n";
15 cout.setf( ios::showpoint );
16 cout << "9.9900 prints as: " << 9.9900
17 << "\n9.9000 prints as: " << 9.9000
18 << "\n9.0000 prints as: " << 9.0000 << endl;
19 return 0;
20 }